package org.hh.netty.client;

import com.sun.deploy.util.FXLoader;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import lombok.SneakyThrows;
import org.hh.netty.utils.IpUtil;
import org.hh.netty.utils.SysUtils;

import java.io.InputStream;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.List;
import java.util.Optional;


public class Student extends Application {

    @SneakyThrows
    public static void main(String[] args) {
        launch();
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        AnchorPane root =FXMLLoader.load(getClass().getClassLoader().getResource("fxml/startup.fxml"));
        BorderPane borderPane = (BorderPane) root.getChildren().get(1);
        Label label = (Label) borderPane.getChildren().get(0);
        primaryStage.setTitle("电子教室—学生端");
        primaryStage.setScene(new Scene(root));
        primaryStage.show();
        StudentModel.getInstance().setPrimaryStage(primaryStage);
        new Thread(new StudentConnection(label)).start();
    }
}
